package com.leizi.igym.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.leizi.igym.domain.Lost;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author: leizi0110
 * @CreateTime: 2024-04-21  21:09
 * @Description:
 */

@Data
@Document(indexName = "lost")
public class LostESDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 8775867801195072687L;
    /**
     * 失物招领id
     */
    @Id
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 发布者id
     */
    @Field(type = FieldType.Long)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 失物照片
     */
    @Field(type = FieldType.Keyword,index = false)
    private String picture;

    /**
     * 失物招领标题
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String title;


    /**
     * 上传者昵称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String nickname;

    /**
     * 失物招领描述
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String descrip;

    /**
     * 失物状态，0-未认领找回，1-已认领找回
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer status;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date,format ={},pattern = "yyyy-MM-dd HH:mm:ss" )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Field(type = FieldType.Date,format ={},pattern = "yyyy-MM-dd HH:mm:ss" ,index = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 逻辑删除
     */
    @Field(type = FieldType.Integer)
    private Integer deleted;

    /**
     * 发布者头像
     */
    @Field(type = FieldType.Keyword,index = false)
    private String avatar;

}
